home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / asm_n_z.zip / PMODE.ASM < prev    next >
Assembly Source File  |  1986-03-01  |  11KB  |  308 lines

  1.          NAME      PMODE
  2.          PAGE      58,132
  3.          TITLE     '        P M O D E   ---  SET LPT1: print options'
  4.  
  5.  
  6.  
  7.  
  8.  
  9. COMMENT  /*
  10.  
  11.    UTILITY TO SET PRINTER (LPT1: PRN) MODES ON IBM PERSONAL COMPUTER
  12.  
  13.   PMODE is a DOS command (P.COM) which will set frequently used printer
  14.   options on the EPSON MX-80 or MX-100 printer. Only those options that
  15.   I frequently desire are set in order to keep the size of the command
  16.   within 256 bytes, which allows it to fit within one cluster on my RAM
  17.   drive. For the same reason, only one single character keyword option
  18.   may be specified with each execution. You can however issue the
  19.   command multiple times to achieve complimentary results, if they are
  20.   allowed by the printer.
  21.  
  22.   Only the default printer may be set with this version. Other printers
  23.   may be selected by changing the value in the DH reg just prior to the
  24.   INT 17 in the PRTIO subroutine.
  25.  
  26.   Other options can be easily added if you keep the keyword to a single
  27.   unique letter of a thru z.
  28.  
  29.   Due to size no ERROR RECOVERY is performed. If the printer is turned
  30.   off or not ready nothing will happen. The bell is rung with each
  31.   successful execution, (except top of form) to let you know the IO was
  32.   performed.
  33.  
  34.   I renamed the command to P.COM for easy of execution but you can call
  35.   it whatever you like.
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.          */
  43.          PAGE
  44.  
  45.  
  46. COMMENT  /*
  47.  
  48.  
  49.   FORMAT:
  50.  
  51.     P option
  52.  
  53.   OPTION:
  54.  
  55.           T - Eject to next top of form
  56.  
  57.           B - Ring the bell. Helpful to detect if the printer is ready.
  58.  
  59.           C - Turn on COMPRESSED print (not valid with EMPHASIZED).
  60.  
  61.           D - Turn on DOUBLE STRIKE mode.
  62.  
  63.           E - Turn on EMPHASIZED mode (not valid with COMPRESSED mode).
  64.  
  65.           N - Turn off automatic skip over perforation.
  66.  
  67.           S - Set automatic skip over perforation to 6 lines.
  68.  
  69.           R - RESET printer to power up specifications.
  70.  
  71.           6 - Set printer spacing to 6 lines per inch.
  72.  
  73.           8 - Set printer spacing to 8 lines per inch.
  74.  
  75.  
  76.   EXAMPLE:
  77.  
  78.    p n      - Turn off automatic skip over perforation.
  79.  
  80.    p d      - Turn on double strike.
  81.  
  82.  
  83.  
  84.    (C)Copyright September 1983:
  85.  
  86.    Timothy M. Hanes               (713) 350-1438
  87.  
  88.    ASYST Inc.                     (713) 776-9091
  89.    7502 Corporate Dr. Suite 237
  90.    Houston, Tx. 77036
  91.  
  92.                                                                      */
  93.          PAGE
  94.  
  95.  
  96.  
  97. ;**********************
  98. ;*       EQUATES      *
  99. ;**********************
  100.  
  101.  
  102. INPUT    EQU       080H           ;address of command tail
  103.                                   ;buffer (set up by DOS)
  104. BELL     EQU       07H            ;EPSON buzzer
  105. BLANK    EQU       20H            ;ASCII blank code
  106. COMP     EQU       0FH            ;EPSON compressed
  107. CR       EQU       0DH            ;ASCII carriage return
  108. DBLSTK   EQU       47H            ;EPSON double strike
  109. EMPHSIZ  EQU       45H            ;EPSON emphasize
  110. ESC      EQU       1BH            ;ASCII escape code
  111. LF       EQU       0AH            ;ASCII line feed
  112. LPI_6    EQU       32H            ;EPSON 6 lines per inch
  113. LPI_8    EQU       30H            ;EPSON 8 lines per inch
  114. NSOP     EQU       4FH            ;EPSON no skip over perf
  115. RESET    EQU       40H            ;EPSON reset to power up state
  116. SOP      EQU       4EH            ;EPSON skip over perf
  117. TOF      EQU       0CH            ;EPSON advance to top of form
  118.  
  119. MASK_DF  EQU       11011111B      ;mask to AND lower case to upper case
  120.          PAGE
  121.  
  122.  
  123.  
  124. CSEG     SEGMENT   BYTE
  125.          ASSUME    CS:CSEG,DS:CSEG
  126.          ORG       100H
  127.  
  128.  
  129.  
  130. PMODE:                            ;
  131.          MOV       DI,OFFSET INPUT ;initialize DI to the
  132.                                   ;address of the input buffer
  133.          MOV       AL,[DI]        ;check if any command tail
  134.          OR        AL,AL          ;and if not
  135.          JZ        NODATA         ;go set no input msg
  136.          MOV       AL,BLANK       ;load ASCII blank for scan
  137.          INC       DI             ;increment address in DI
  138.                                   ;past the input count byte
  139.          MOV       CX,80          ;scan max of 80 chars.
  140.          CLD                      ;clear direction flag
  141.          REPZ SCASB               ;look for first non-blank
  142.                                   ;character in input buffer
  143.          JZ        NODATA         ;if none found set no input msg
  144.          XOR       AX,AX          ;zero  AX
  145.          XOR       DX,DX          ;zero  DX
  146.                                   ;load the non-blank char.,
  147.          MOV       DL,-1[DI]      ;use offset 0f -1 since DI
  148.                                   ;will be pointing past it
  149.          CMP       DL,CR          ;if first non-blank char was CR
  150.          JE        NODATA         ;set no input msg
  151.  
  152.          CMP       DL,'a'         ;compare for lower case a
  153.          JB        SELECT         ;go select if < a
  154.          CMP       DL,'z'         ;compare for lower case z
  155.          JA        SELECT         ;go select if > z
  156.          AND       DL,MASK_DF     ;change lower case to upper case
  157.  
  158.          PAGE
  159.  
  160. SELECT:                           ;select the input character
  161.          CMP       DL,'T'         ;was it upper case "T"
  162.          JNE       NOT_T          ;no, go check for next character
  163. SETTOF:  MOV       AL,TOF         ;insert printer code
  164.          JMP       SHORT SENDCODE ;go do printer io
  165.  
  166. NOT_T:                            ;check input character
  167.  
  168.          CMP       DL,'C'         ;was it upper case "C"
  169.          JNE       NOT_C          ;no, go check for next character
  170. SETCOMP: MOV       AL,COMP        ;insert printer code
  171.          JMP       SHORT SENDCODE ;go do printer io
  172.  
  173. NOT_C:                            ;check input character
  174.  
  175.          CMP       DL,'D'         ;was it upper case "D"
  176.          JNE       NOT_D          ;no, go check for next character
  177. SETDBL:  MOV       AL,DBLSTK      ;insert printer code
  178.          JMP       SHORT ESC1ST   ;go do printer io
  179.  
  180. NOT_D:                            ;check input character
  181.  
  182.          CMP       DL,'E'         ;was it upper case "E"
  183.          JNE       NOT_E          ;no, go check for next character
  184. SETEMPH: MOV       AL,EMPHSIZ     ;insert printer code
  185.          JMP       SHORT ESC1ST   ;go do printer io
  186.  
  187. NOT_E:                            ;check input character
  188.  
  189.          CMP       DL,'N'         ;was it upper case "N"
  190.          JNE       NOT_N          ;no, go check for next character
  191. SETNSOP: MOV       AL,NSOP        ;insert printer code
  192.          JMP       SHORT ESC1ST   ;go do printer io
  193.  
  194. NOT_N:                            ;check input character
  195.  
  196.          CMP       DL,'S'         ;was it upper case "S"
  197.          JNE       NOT_S          ;no, go check for next character
  198. SETSOP:  MOV       AL,SOP         ;insert printer code
  199.          JMP       SHORT ESC1ST   ;go do printer io
  200.  
  201. NOT_S:                            ;check input character
  202.  
  203.          CMP       DL,'R'         ;was it upper case "R"
  204.          JNE       NOT_R          ;no, go check for next character
  205. SETRSET: MOV       AL,RESET       ;insert printer code
  206.          JMP       SHORT ESC1ST   ;go do printer io
  207.  
  208. NOT_R:                            ;check input character
  209.  
  210.          CMP       DL,'6'         ;was it "6"
  211.          JNE       NOT_6          ;no, go check for next character
  212. SETLPI6: MOV       AL,LPI_6       ;insert printer code
  213.          JMP       SHORT ESC1ST   ;go do printer io
  214.  
  215. NOT_6:                            ;check input character
  216.  
  217.          CMP       DL,'8'         ;was it "8"
  218.          JNE       NOT_8          ;no, go check for next character
  219. SETLPI8: MOV       AL,LPI_8       ;insert printer code
  220.          JMP       SHORT ESC1ST   ;go do printer io
  221.  
  222. NOT_8:                            ;check input character
  223.  
  224.          CMP       DL,'B'         ;was it upper case "B"
  225.          JE        RINGBELL       ;yes go ring the the bell
  226.  
  227. ;        all other codes come thru here and are invalid
  228.  
  229. NODATA:                           ;no input data
  230.          MOV       DX,OFFSET MSG1 ;set msg and
  231.